Skip to content

fix(ssr): trust proxy headers, and stop offering rollover and PDF - #4

Merged
theprogrammersingh merged 1 commit into
mainfrom
fix/ssr-proxy-headers
Sep 3, 2026
Merged

fix(ssr): trust proxy headers, and stop offering rollover and PDF#4
theprogrammersingh merged 1 commit into
mainfrom
fix/ssr-proxy-headers

Conversation

@theprogrammersingh

Copy link
Copy Markdown
Owner

SSR was off on the deploy, and not for the documented reason. Angular deopts to client-side rendering on any untrusted x-forwarded-* header — a normal 200 that was never server-rendered. Its default covers only host and proto; Render also sends x-forwarded-for. A host-allowlist miss, what the docs blamed, is a hard 400 instead.

Reproduced locally first, with Angular naming the header in its own log:

curl -s -H 'X-Forwarded-For: 203.0.113.9' localhost:8080/   -> no marker

frontend/src/server.ts now trusts the full set, reading NG_TRUST_PROXY_HEADERS first so a deploy can narrow it. verify-deploy.mjs gave the wrong advice for this and now branches on the status code.

Also removes two false affordances:

  • The Budgets "roll unspent budget into next month" checkbox, read by nothing. Column and DTO field stay; a spec fails if it returns without the behaviour.
  • format: 'pdf', advertised in the tool schema and silently answered with CSV. Now rejected at all four layers, with a contract spec pinning the tool schema and the backend DTO to the same list.

Verified: format: pdf -> 400, csv -> 201, and verify:deploy passes all six against the composed server locally.

Gate: 898 tests green, typechecks and build clean. Needs a redeploy — the fix is in the built SSR bundle.

SSR was off on the deploy, and not for the documented reason. Angular
deopts to client-side rendering on any untrusted `x-forwarded-*` header —
a normal 200 that was never server-rendered. Its default covers only host
and proto; Render also sends `x-forwarded-for`. A host-allowlist miss, what
the docs blamed, is a hard 400 instead.

Reproduced locally first, with Angular naming the header in its own log:

    curl -s -H 'X-Forwarded-For: 203.0.113.9' localhost:8080/   -> no marker

`frontend/src/server.ts` now trusts the full set, reading
NG_TRUST_PROXY_HEADERS first so a deploy can narrow it. `verify-deploy.mjs`
gave the wrong advice for this and now branches on the status code.

Also removes two false affordances:

- The Budgets "roll unspent budget into next month" checkbox, read by
  nothing. Column and DTO field stay; a spec fails if it returns without
  the behaviour.
- `format: 'pdf'`, advertised in the tool schema and silently answered with
  CSV. Now rejected at all four layers, with a contract spec pinning the
  tool schema and the backend DTO to the same list.

Verified: `format: pdf` -> 400, `csv` -> 201, and verify:deploy passes all
six against the composed server locally.

Gate: 898 tests green, typechecks and build clean. Needs a redeploy — the
fix is in the built SSR bundle.
@theprogrammersingh
theprogrammersingh merged commit 31f0753 into main Sep 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant